<template>
    <div>
<table>
    <tr>
        <td>编号</td>
        <td>名称</td>
        <td>电话</td>
        <td>状态</td>
        <td>简介</td>
        <td>地址</td>
        <td>操作</td>
    </tr>
    <tr v-for="item in list">
        <td>{{ item.mid }}</td>
        <td>{{ item.mname }}</td>
        <td>{{ item.mphone }}</td>
        <td>{{ item.mstate }}</td>
        <td>{{ item.mjianjie }}</td>
        <td>{{ item.dizhi }}</td>
        <td>  <input type="button" value="删除" @click="shan(item.mid)"/></td>
    </tr>
</table>
    </div>
</template>

<script setup lang="ts">
import {  reactive,toRefs, onMounted} from 'vue'
import { useRoute,useRouter } from 'vue-router'
import axios from 'axios'   
const router = useRouter()
const route = useRoute()

const data:any=reactive({
    list:[]
})

const {list} =toRefs(data)

onMounted(()=>{
  functions()
})
const functions=()=>{
    axios({
        url:'https://localhost:7271/api/Member/ShowMember',
        method:'get',
       

    }).then((res)=>{
        console.log(res)
        data.list=res.data.data
    })
}

const shan=(mid:any)=>{
    axios({
        url:'https://localhost:7271/api/Member/deleteMember',
        method:'get',
        params:{
            Mid:mid
        }
    }).then((res)=>{
        console.log(res)
        alert('删除成功')
        functions()
    })
}





</script>

<style scoped>

</style>